/**
 * 
 */
package cn.agiledata.bank.audit.logic;

import cn.agiledata.bank.common.bean.IntEnum;

public class AuditLevel extends IntEnum {
    public static final AuditLevel LEVEL_UNKNOWN = new AuditLevel(-99);

    public static final AuditLevel LEVEL_PRIMARY = new AuditLevel(1);

    private AuditLevel(int value) {
        super(value);
    }

    public static AuditLevel getAuditLevel(int value) {
        if (value < LEVEL_PRIMARY.getValue())
            return LEVEL_UNKNOWN;
        if (value == LEVEL_PRIMARY.getValue())
            return LEVEL_PRIMARY;
        return new AuditLevel(value);
    }

    public static AuditLevel maxAuditLevelSupported() {
        int maxLevelValue = AuditStatus.STATUS_FINAL.getValue() - 1;
        return AuditLevel.getAuditLevel(maxLevelValue);
    }

    public AuditLevel nextAuditLevel() {
        return new AuditLevel(this.getValue() + 1);
    }

}